package org.bridgen.runtime;

import org.bridgen.runtime.log.RecoveryLog;
import org.bridgen.runtime.model.SOF;

/**
 * Recovery option containing a token list and a recovery log gathered during 
 * bridge building and recovery
 * 
 * @author Emma Söderberg <emma add cs.lth.se>
 *
 */

public class RecoveryOption {
	
	private SOF sof;
	private RecoveryLog log;
	private String recoveredText;
	
	private int nbrInitialIslands;
	private int nbrUnmatchedIslands;
	private int nbrFakeIslands;
	
	public RecoveryOption(SOF sof) {
		this.sof = sof;
		this.log = new RecoveryLog();
		recoveredText = RecoveryHelper.prettyPrint(sof).toString();
	}
	
	public String getRecoveredText() {
		return recoveredText;
	}
	
	public String toString() {
		String recoveredText = RecoveryHelper.prettyPrint(sof).toString();
		String result = "recovered text:\n" + recoveredText + "\n#initial-islands: " + nbrInitialIslands + "\n" +
			"#unmatched-islands: " + nbrUnmatchedIslands + "\n" + 
			"#fake-islands: " + nbrFakeIslands + "\n" + log;
		return result;
	}
	
	public SOF getSOF() {
		return sof;
	}
	public RecoveryLog getLog() {
		return log;
	}
	public void setNbrInitialIslands(int nbr) {
		nbrInitialIslands = nbr;
	}
	public int getNbrInitialIslands() {
		return nbrInitialIslands;
	}
	public void setNbrUnmatchedIslands(int nbr) {
		nbrUnmatchedIslands = nbr;
	}
	public int getUnmatchedIslands() {
		return nbrUnmatchedIslands;
	}
	public void setNbrFakeIslands(int nbr) {
		nbrFakeIslands = nbr;
	}
	public int getNbrFakeIslands() {
		return nbrFakeIslands;
	}
}